// Fill out your copyright notice in the Description page of Project Settings.


#include "EnemyInstance.h"
#include "MyCharacter.h"
#include "Enemy.h"

void UEnemyInstance::UpdateAnimation() 
{
	if (!Pawn)
	{
		Pawn = TryGetPawnOwner();
	}
	else 
	{
		FVector Speed = Pawn->GetVelocity();
		FVector LaterialSpeed = FVector(Speed.X, Speed.Y, 0);
		MoveSpeed = LaterialSpeed.Size();
	}
}

void UEnemyInstance::NativeInitializeAnimation() 
{
	if (!Pawn) 
	{
		Pawn = TryGetPawnOwner();
	}
	Enemy = Cast<AEnemy>(Pawn);
}